import React from 'react'
export function myloadable(loader){
  
  return class Temp extends React.Component{
    state = {
      Bar:null
    }
    componentDidMount(){
      loader().then(data=>{
        setTimeout(() => {
          this.setState({
            Bar:data.default
          })
        }, 10);
        
      })
    }
    render(){
      let {Bar} = this.state
      return <>
        {
          Bar ? 
          <Bar {...this.props}/>:
          <div>loading</div>
        }
      </>
    }
  }
  
}